<template>
    <!-- 表单弹出层 -->
    <div>
        <el-form :inline="true" :model="formInline" label-width="200px" class="demo-form-inline">

            <el-form-item label="编号">
                <el-input v-model="formInline.number" clearable />
            </el-form-item>
            <el-form-item label="项目负责人">
                <el-input v-model="formInline.projectLeader" clearable />
            </el-form-item>
            <el-form-item label="位置">
                <el-input v-model="formInline.entryName" clearable />
            </el-form-item>
            <el-form-item label="型号">
                <el-input v-model="formInline.model" clearable />
            </el-form-item>
            <!-- <el-form-item label="所属部门">
                <el-input v-model="formInline.belonging" clearable />
            </el-form-item> -->
            <el-form-item label="所属部门" prop="belonging">
                <el-select v-model="formInline.belonging" placeholder="选择部门">
                    <el-option label="数据一部" value=1 />
                    <el-option label="数据二部" value=2 />
                    <el-option label="数据三部" value=3 />
                    <el-option label="数据四部" value=4 />
                    <el-option label="数据五部" value=5 />
                    <el-option label="办公室" value=6 />
                    <el-option label="其他" value=7 />

                </el-select>
            </el-form-item>
            <!-- <el-form-item label="实在部门">
                <el-input v-model="formInline.realDepartment" clearable />
            </el-form-item> -->
            <el-form-item label="实在部门" prop="realDepartment">
                <el-select v-model="formInline.realDepartment" placeholder="选择部门">
                    <el-option label="数据一部" value=1 />
                    <el-option label="数据二部" value=2 />
                    <el-option label="数据三部" value=3 />
                    <el-option label="数据四部" value=4 />
                    <el-option label="数据五部" value=5 />
                    <el-option label="办公室" value=6 />
                    <el-option label="其他" value=7 />

                </el-select>
            </el-form-item>
            <el-form-item label="序列号">
                <el-input v-model="formInline.serialNumber" clearable />
            </el-form-item>
            <el-form-item label="是否使用客户硬盘">
                <el-input v-model="formInline.position" clearable />
            </el-form-item>
            <el-form-item label="客户硬盘序列号">
                <el-input v-model="formInline.customerDrive" clearable />
            </el-form-item>
            <!-- <el-form-item label="设备使用情况">
                <el-input v-model="formInline.usageSituation" clearable />
            </el-form-item> -->
            <el-form-item label="设备使用情况" prop="usageSituation">
                <el-select v-model="formInline.usageSituation" placeholder="使用情况">
                    <el-option label="使用中" value='使用中' />
                    <el-option label="闲置" value='闲置' />
                </el-select>
            </el-form-item>
            <el-form-item label="机箱">
                <el-input v-model="formInline.chassisCondition" clearable />
            </el-form-item>
            <el-form-item label="备注">
                <el-input v-model="formInline.remarks" clearable />
            </el-form-item>
            <el-form-item label="维修记录">
                <el-input v-model="formInline.maintenanceRecord" clearable />
            </el-form-item>
            <el-form-item label="设备状态">
                <!-- <el-input v-model="formInline.equipmentStatus" clearable /> -->
                <el-select v-model="formInline.equipmentStatus" placeholder="是否启用">
                    <el-option label="启用" value=1 />
                    <el-option label="停用" value=0 />
                </el-select>
            </el-form-item>
            <el-form-item label="流程状态">
                <el-input v-model="formInline.processStatus" clearable />
            </el-form-item>
            <el-form-item label="问题记录">
                <el-input v-model="formInline.problemRecord" clearable />
            </el-form-item>
            <el-form-item label="检查时间">
                <el-input v-model="formInline.checksTime" clearable disabled=true />
            </el-form-item>
            <el-form-item label="检查状态">
                <!-- <el-input v-model="formInline.equipmentStatus" clearable /> -->
                <el-select v-model="formInline.checkStatus" placeholder="检查状态">
                    <el-option label="待检查" value=1 />
                    <el-option label="已处理" value=2 />
                    <el-option label="待处理" value=3 />
                </el-select>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="onSubmit">提交修改</el-button>
            </el-form-item>
        </el-form>
    </div>
</template>

<script setup>
import { reactive } from 'vue'
import { gettables, gettablebm, changelist } from '../../sevce/user'
import { defineProps, onMounted, ref, computed, defineEmits } from 'vue';
import { ElMessage } from 'element-plus'
const props = defineProps({
    id: Number,
    number: String,
    equipmentName: String,
    entryName: String,
    model: String,
    belonging: String,
    realDepartment: String,
    serialNumber: String,
    projectLeader: String,
    applicationTime: Date,//申请时间
    position: String,
    customerDrive: String,
    usageSituation: String,
    equipmentStatus: Number,
    processStatus: Number,
    remarks: String,
    approvalTime: String,
    chassisCondition: String,
    maintenanceRecord: String,
    problemRecord: String,//问题记录
    checkStatus: Number,//检查状态
    checksTime: Date,//检查时间
})
const formInline = reactive({
    id: props.id,
    number: props.number,
    equipmentName: props.equipmentName,
    entryName: props.entryName,
    model: props.model,
    belonging: props.belonging,
    realDepartment: props.realDepartment,
    serialNumber: props.serialNumber,
    projectLeader: props.projectLeader,
    applicationTime: props.applicationTime,
    position: props.position,
    customerDrive: props.customerDrive,
    usageSituation: props.usageSituation,
    equipmentStatus: props.equipmentStatus,
    processStatus: props.processStatus,
    remarks: props.remarks,
    approvalTime: props.approvalTime,
    chassisCondition: props.chassisCondition,
    maintenanceRecord: props.maintenanceRecord,
    problemRecord: props.problemRecord,
    checkStatus: props.checkStatus,
    checksTime: props.checksTime,

    // check_status: 0,
})
//修改完成更新数据
let emit = defineEmits(['addEvent'])
function gxfather() {
    emit('addEvent');
    // console.log('==========')
}
const onSubmit = () => {
    console.log('submit!')
    changelist(formInline).then((res) => {
        // console.log('okk')
        if (res.data == 0) {
            ElMessage.error('修改失败')
        } else if (res.data == 1) {
            ElMessage({
                message: '修改成功',
                type: 'success',
            })
            gxfather()
        }
    })
}
onMounted(() => {
    console.log(props)
})
</script>

<style lang="scss" scoped>
.demo-form-inline .el-input {
    --el-input-width: 220px;
}

.demo-form-inline .el-select {
    --el-select-width: 220px;
}
</style>